/* pts03ChatMessage.cpp
 *
 * --
 * Copyright (c) 2012, Christophe Huriaux
 * Distributed under the terms of the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * --
 */

#include <packet/pts03ChatMessage.h>
#include <wrapper/JavaStreamWrapper.h>

pts03ChatMessage::pts03ChatMessage()
    : McPacketToServer(0x03), message("")
{
}

pts03ChatMessage::pts03ChatMessage(std::string message)
    : McPacketToServer(0x03), message(message)
{
}

unsigned int pts03ChatMessage::length()
{
    return 1 + 2 + message.length();
}

void pts03ChatMessage::forge(std::ostream& out)
{
    JavaStreamWrapper jsw(out);

    jsw.writeByte(getPacketId());
    jsw.writeUTF(message);

}

std::string pts03ChatMessage::getMessage()
{
    return message;
}


void pts03ChatMessage::setMessage(std::string message)
{
    this->message = message;
}


